from django_filters import rest_framework as filters

from django_celery_beat.models import PeriodicTask


class SchedulesFilter(filters.FilterSet):
    # like模糊查询方式
    name = filters.CharFilter(field_name='name', lookup_expr='contains')
    enabled = filters.BooleanFilter(field_name='enabled')

    class Meta:
        model = PeriodicTask
        fields = ['name', 'enabled']
